/*
 * @(#)SaveXmlAction.java
 *
 *
 * ver 1.0 Oct 3, 2007 ggranum
 */
package org.testfire.agent.action;

import java.util.Map;
import org.testfire.agent.util.TestsetUtil;
import org.testfire.model.TestsetType;
import org.testfire.support.S;

// eof: SaveXmlAction.java

/**
 * Save an XML Testset to the local store.
 */
public class ToWatijTranslateAction extends Action
{
    public ToWatijTranslateAction()
    {
        super( false, new String[]{"testset_xml"}, new String[0] );
    }

    public String perform( Map<String, String> params, Map<String, String[]> paramValues )
    {

        String xml = params.get( "testset_xml" );
        StringBuffer buf = new StringBuffer();
        if ( !S.empty( xml ) )
        {
            TestsetType testset = TestsetUtil.getTestSet( xml );
            buf.append( String.valueOf( testset.translate( testset ) ));
        }
        return buf.toString();
    }


}